package com.example.springbootdemo.app.service.impl;

import com.example.springbootdemo.api.DTO.AddStudentDTO;
import com.example.springbootdemo.app.service.StudentService;
import com.example.springbootdemo.domin.VO.getScoreDetailVO;
import com.example.springbootdemo.domin.entity.Student;
import com.example.springbootdemo.infra.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public Student getById(Integer sno) {
        return studentMapper.getById(sno);
    }

    @Override
    public void update(Student student) {
        studentMapper.updateById(student);
    }

    @Override
    public void deleteById(Integer sno) {
        studentMapper.deleteById(sno);
    }

    @Override
    public void insertStudent(Student student) {
        studentMapper.insertStudent(student);
    }

    @Override
    public void insertStudents(List<AddStudentDTO> list) {
        studentMapper.insertStudents(list);
    }

    @Override
    public List<Student> getAll() {
        return studentMapper.getAll();
    }

    @Override
    public List<getScoreDetailVO> getScoreDetail(String sname) {
        return studentMapper.getScoreDetail(sname);
    }
}
